#include "contrasttester.h"
#include "ui_contrasttester.h"

#include "imagecontrast.h"

ContrastTester::ContrastTester(const QImage &source, QWidget *parent) :
  QWidget(parent),
  ui(new Ui::ContrastTester), _source(source)
{
  ui->setupUi(this);
  connect(ui->brightness,SIGNAL(valueChanged(int)),this,SLOT(updateImage()));
  connect(ui->contrast,SIGNAL(valueChanged(int)),this,SLOT(updateImage()));
}

ContrastTester::~ContrastTester()
{
  delete ui;
}

void ContrastTester::updateImage()
{
  QImage dst = changeContrast(changeBrightness(_source,ui->brightness->value()),ui->contrast->value());
  ui->image->setPixmap(QPixmap::fromImage(dst));
}
